<template>
  <webview :closable="isClosable" :src="src" />
</template>

<script>
import { panoHTML } from "@/utils/preload-tools";

import Webview from "@/components/webview/index.vue";

export default {
  components: {
    Webview,
  },
  props: {
    hotel_id: {
      type: [Number, String],
      default: 0,
    },
    closable: {
      type: Boolean,
      default: true,
    },
  },
  data() {
    return {
      current_hotel_id: 0,
      isClosable: this.closable,
    };
  },
  computed: {
    src() {
      const hotel_id = this.hotel_id || this.current_hotel_id;
      const offline = this.$store.state.config.mode === "offline" ? 1 : 0;
      const src = `file://${panoHTML}?hotel_id=${hotel_id}&offline=${offline}`;
      return src;
    },
  },
  methods: {
    show(hotel_id) {
      this.current_hotel_id = hotel_id;
    },
  },
};
</script>
